home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-2.iso / Files II / Prog / U-Z / VideoToolbox 4.95.sit / VideoToolbox / VideoToolboxSources / Choose.c < prev    next >
MacBinary  |  1995-01-07  |  6.9 KB  |  [TEXT/MMCC]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Sat Jan 7 22:05:59 1995, modified Sat Jan 7 22:05:59 1995, creator 'MMCC', type ASCII, 6189 bytes "Choose.c" , at 0x18ad 548 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MMCC]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 43 68 6f 6f 73 65 | 2e 63 00 00 00 00 00 00 |..Choose|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 4d 43 | 43 00 00 00 00 00 00 00 |.TEXTMMC|C.......|
|00000050| 00 00 00 00 00 18 2d 00 | 00 02 24 ab 35 07 17 ab |......-.|..$.5...|
|00000060| 35 07 17 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |5.......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 de 3d 00 00 |........|.....=..|
|00000080| 2f 2a 0d 43 68 6f 6f 73 | 65 2e 63 0d 0d 43 68 6f |/*.Choos|e.c..Cho|
|00000090| 6f 73 65 28 29 20 75 73 | 65 73 20 74 68 65 20 63 |ose() us|es the c|
|000000a0| 6f 6e 73 6f 6c 65 20 74 | 6f 20 61 73 6b 20 74 68 |onsole t|o ask th|
|000000b0| 65 20 75 73 65 72 20 61 | 20 6d 75 6c 74 69 70 6c |e user a| multipl|
|000000c0| 65 20 63 68 6f 69 63 65 | 20 71 75 65 73 74 69 6f |e choice| questio|
|000000d0| 6e 20 61 6e 64 20 61 63 | 63 65 70 74 0d 61 20 74 |n and ac|cept.a t|
|000000e0| 79 70 65 64 20 61 6e 73 | 77 65 72 2e 20 49 74 20 |yped ans|wer. It |
|000000f0| 6d 69 6e 69 6d 69 7a 65 | 73 20 74 68 65 20 6e 75 |minimize|s the nu|
|00000100| 6d 62 65 72 20 6f 66 20 | 6b 65 79 73 74 72 6f 6b |mber of |keystrok|
|00000110| 65 73 20 74 68 65 20 75 | 73 65 72 20 68 61 73 20 |es the u|ser has |
|00000120| 74 6f 20 74 79 70 65 2e | 20 54 68 65 0d 75 73 65 |to type.| The.use|
|00000130| 72 20 63 61 6e 20 73 65 | 6c 65 63 74 20 74 68 65 |r can se|lect the|
|00000140| 20 64 65 66 61 75 6c 74 | 20 61 6e 73 77 65 72 20 | default| answer |
|00000150| 62 79 20 6a 75 73 74 20 | 68 69 74 74 69 6e 67 20 |by just |hitting |
|00000160| 3c 63 72 3e 2c 20 6f 72 | 20 63 61 6e 20 73 65 6c |<cr>, or| can sel|
|00000170| 65 63 74 20 61 6e 79 20 | 6f 66 0d 74 68 65 20 63 |ect any |of.the c|
|00000180| 68 6f 69 63 65 73 20 62 | 79 20 74 79 70 69 6e 67 |hoices b|y typing|
|00000190| 20 6a 75 73 74 20 65 6e | 6f 75 67 68 20 63 68 61 | just en|ough cha|
|000001a0| 72 61 63 74 65 72 73 20 | 28 74 79 70 69 63 61 6c |racters |(typical|
|000001b0| 6c 79 20 6a 75 73 74 20 | 6f 6e 65 29 20 74 6f 20 |ly just |one) to |
|000001c0| 6d 61 6b 65 20 61 6e 0d | 75 6e 61 6d 62 69 67 69 |make an.|unambigi|
|000001d0| 6f 75 73 20 73 65 6c 65 | 63 74 69 6f 6e 2e 20 43 |ous sele|ction. C|
|000001e0| 68 6f 6f 73 65 28 29 20 | 61 75 74 6f 6d 61 74 69 |hoose() |automati|
|000001f0| 63 61 6c 6c 79 20 73 70 | 65 6c 6c 73 20 6f 75 74 |cally sp|ells out|
|00000200| 20 74 68 65 20 72 65 73 | 74 20 6f 66 20 74 68 65 | the res|t of the|
|00000210| 20 63 68 6f 69 63 65 2e | 0d 54 68 65 20 75 73 65 | choice.|.The use|
|00000220| 72 20 44 4f 45 53 20 4e | 4f 54 20 68 61 76 65 20 |r DOES N|OT have |
|00000230| 74 6f 20 74 65 72 6d 69 | 6e 61 74 65 20 74 68 65 |to termi|nate the|
|00000240| 20 61 6e 73 77 65 72 20 | 77 69 74 68 20 61 20 72 | answer |with a r|
|00000250| 65 74 75 72 6e 2e 20 54 | 68 69 73 20 6d 61 6b 65 |eturn. T|his make|
|00000260| 73 20 69 74 0d 66 65 61 | 73 69 62 6c 65 20 74 6f |s it.fea|sible to|
|00000270| 20 61 73 6b 20 74 68 65 | 20 75 73 65 72 20 61 20 | ask the| user a |
|00000280| 6c 6f 6e 67 20 73 65 72 | 69 65 73 20 6f 66 20 6d |long ser|ies of m|
|00000290| 75 6c 74 69 70 6c 65 2d | 63 68 6f 69 63 65 20 71 |ultiple-|choice q|
|000002a0| 75 65 73 74 69 6f 6e 73 | 2c 20 73 69 6e 63 65 20 |uestions|, since |
|000002b0| 74 68 65 0d 75 73 65 72 | 20 63 61 6e 20 71 75 69 |the.user| can qui|
|000002c0| 63 6b 6c 79 20 68 69 74 | 20 72 65 74 75 72 6e 20 |ckly hit| return |
|000002d0| 74 6f 20 6f 62 74 61 69 | 6e 20 64 65 66 61 75 6c |to obtai|n defaul|
|000002e0| 74 20 61 6e 73 77 65 72 | 73 20 61 6e 64 20 6e 65 |t answer|s and ne|
|000002f0| 65 64 20 6f 6e 6c 79 20 | 74 79 70 65 20 6f 6e 65 |ed only |type one|
|00000300| 20 28 6f 72 0d 61 20 66 | 65 77 29 20 63 68 61 72 | (or.a f|ew) char|
|00000310| 61 63 74 65 72 73 20 74 | 6f 20 73 65 6c 65 63 74 |acters t|o select|
|00000320| 20 6e 6f 6e 2d 64 65 66 | 61 75 6c 74 20 63 68 6f | non-def|ault cho|
|00000330| 69 63 65 73 2e 0d 0d 09 | 69 6e 74 20 43 68 6f 6f |ices....|int Choo|
|00000340| 73 65 28 69 6e 74 20 64 | 65 66 61 75 6c 74 43 68 |se(int d|efaultCh|
|00000350| 6f 69 63 65 2c 63 6f 6e | 73 74 20 63 68 61 72 20 |oice,con|st char |
|00000360| 2a 71 75 65 72 79 2c 63 | 6f 6e 73 74 20 63 68 61 |*query,c|onst cha|
|00000370| 72 20 2a 63 68 6f 69 63 | 65 73 5b 5d 2c 69 6e 74 |r *choic|es[],int|
|00000380| 20 6e 29 3b 0d 0d 09 63 | 68 6f 69 63 65 3d 43 68 | n);...c|hoice=Ch|
|00000390| 6f 6f 73 65 28 63 68 6f | 69 63 65 2c 22 57 69 6c |oose(cho|ice,"Wil|
|000003a0| 6c 20 79 6f 75 20 65 61 | 74 20 25 73 3f 5c 6e 22 |l you ea|t %s?\n"|
|000003b0| 2c 62 72 65 61 64 46 69 | 73 68 2c 32 29 3b 0d 0d |,breadFi|sh,2);..|
|000003c0| 54 68 65 20 66 69 72 73 | 74 20 61 72 67 75 6d 65 |The firs|t argume|
|000003d0| 6e 74 20 61 6e 64 20 72 | 65 74 75 72 6e 65 64 20 |nt and r|eturned |
|000003e0| 76 61 6c 75 65 20 61 72 | 65 20 69 6e 74 2c 20 77 |value ar|e int, w|
|000003f0| 69 74 68 20 76 61 6c 75 | 65 73 20 69 6e 20 74 68 |ith valu|es in th|
|00000400| 65 20 72 61 6e 67 65 20 | 30 20 74 6f 0d 6e 2d 31 |e range |0 to.n-1|
|00000410| 2c 20 77 68 65 72 65 20 | 6e 20 28 74 68 65 20 6c |, where |n (the l|
|00000420| 61 73 74 20 61 72 67 75 | 6d 65 6e 74 29 20 69 73 |ast argu|ment) is|
|00000430| 20 74 68 65 20 6e 75 6d | 62 65 72 20 6f 66 20 70 | the num|ber of p|
|00000440| 6f 73 73 69 62 6c 65 20 | 63 68 6f 69 63 65 73 2e |ossible |choices.|
|00000450| 20 54 68 65 0d 73 65 63 | 6f 6e 64 20 61 72 67 75 | The.sec|ond argu|
|00000460| 6d 65 6e 74 20 69 73 20 | 61 20 66 6f 72 6d 61 74 |ment is |a format|
|00000470| 20 73 74 72 69 6e 67 20 | 74 6f 20 62 65 20 75 73 | string |to be us|
|00000480| 65 64 20 20 28 77 69 74 | 68 6f 75 74 20 74 68 65 |ed (wit|hout the|
|00000490| 20 6f 70 74 69 6f 6e 61 | 6c 20 74 72 61 69 6c 69 | optiona|l traili|
|000004a0| 6e 67 0d 5c 6e 29 20 69 | 6e 20 61 20 70 72 69 6e |ng.\n) i|n a prin|
|000004b0| 74 66 20 73 74 61 74 65 | 6d 65 6e 74 2e 20 54 68 |tf state|ment. Th|
|000004c0| 65 20 6f 70 74 69 6f 6e | 61 6c 20 25 73 20 77 69 |e option|al %s wi|
|000004d0| 6c 6c 20 62 65 20 65 78 | 70 61 6e 64 65 64 20 69 |ll be ex|panded i|
|000004e0| 6e 74 6f 20 61 20 6c 69 | 73 74 20 6f 66 0d 61 6c |nto a li|st of.al|
|000004f0| 74 65 72 6e 61 74 69 76 | 65 73 20 61 70 70 72 6f |ternativ|es appro|
|00000500| 70 72 69 61 74 65 6c 79 | 20 70 75 6e 63 74 75 61 |priately| punctua|
|00000510| 74 65 64 20 62 79 20 63 | 6f 6d 6d 61 73 20 61 6e |ted by c|ommas an|
|00000520| 64 20 22 6f 72 22 2e 20 | 54 68 65 20 74 68 69 72 |d "or". |The thir|
|00000530| 64 20 61 72 67 75 6d 65 | 6e 74 20 69 73 0d 61 6e |d argume|nt is.an|
|00000540| 20 61 72 72 61 79 20 6f | 66 20 6e 20 73 74 72 69 | array o|f n stri|
|00000550| 6e 67 20 70 6f 69 6e 74 | 65 72 73 2c 20 6f 6e 65 |ng point|ers, one|
|00000560| 20 73 74 72 69 6e 67 20 | 70 65 72 20 63 68 6f 69 | string |per choi|
|00000570| 63 65 2e 20 49 66 20 74 | 68 65 20 73 65 63 6f 6e |ce. If t|he secon|
|00000580| 64 20 61 72 67 75 6d 65 | 6e 74 0d 65 6e 64 73 20 |d argume|nt.ends |
|00000590| 69 6e 20 5c 6e 20 74 68 | 65 6e 20 74 68 65 20 70 |in \n th|en the p|
|000005a0| 72 69 6e 74 69 6e 67 20 | 6f 66 20 74 68 61 74 20 |rinting |of that |
|000005b0| 6e 65 77 6c 69 6e 65 20 | 63 68 61 72 61 63 74 65 |newline |characte|
|000005c0| 72 20 69 73 20 64 65 6c | 61 79 65 64 20 75 6e 74 |r is del|ayed unt|
|000005d0| 69 6c 20 41 46 54 45 52 | 20 70 72 69 6e 74 69 6e |il AFTER| printin|
|000005e0| 67 0d 74 68 65 20 75 73 | 65 72 27 73 20 63 68 6f |g.the us|er's cho|
|000005f0| 69 63 65 2e 0d 0d 54 68 | 65 20 6f 74 68 65 72 20 |ice...Th|e other |
|00000600| 72 6f 75 74 69 6e 65 73 | 20 69 6e 20 74 68 69 73 |routines| in this|
|00000610| 20 66 69 6c 65 2c 20 4d | 75 6c 74 69 70 6c 65 43 | file, M|ultipleC|
|00000620| 68 6f 69 63 65 28 29 20 | 61 6e 64 20 59 65 73 4f |hoice() |and YesO|
|00000630| 72 4e 6f 28 29 20 61 72 | 65 20 6f 62 73 6f 6c 65 |rNo() ar|e obsole|
|00000640| 74 65 2c 0d 73 69 6e 63 | 65 20 43 68 6f 6f 73 65 |te,.sinc|e Choose|
|00000650| 28 29 20 69 73 20 6d 6f | 72 65 20 63 6f 6e 76 65 |() is mo|re conve|
|00000660| 6e 69 65 6e 74 2c 20 62 | 75 74 20 74 68 65 79 20 |nient, b|ut they |
|00000670| 61 72 65 20 72 65 74 61 | 69 6e 65 64 20 66 6f 72 |are reta|ined for|
|00000680| 20 73 75 70 70 6f 72 74 | 20 6f 66 20 6f 6c 64 0d | support| of old.|
|00000690| 70 72 6f 67 72 61 6d 73 | 20 74 68 61 74 20 6d 61 |programs| that ma|
|000006a0| 79 20 75 73 65 20 74 68 | 65 6d 2e 20 43 68 6f 6f |y use th|em. Choo|
|000006b0| 73 65 20 69 73 20 69 6d | 70 6c 65 6d 65 6e 74 65 |se is im|plemente|
|000006c0| 64 20 62 79 20 63 61 6c | 6c 69 6e 67 20 4d 75 6c |d by cal|ling Mul|
|000006d0| 74 69 70 6c 65 43 68 6f | 69 63 65 2e 0d 0d 4d 75 |tipleCho|ice...Mu|
|000006e0| 6c 74 69 70 6c 65 43 68 | 6f 69 63 65 28 29 20 61 |ltipleCh|oice() a|
|000006f0| 63 63 65 70 74 73 20 28 | 61 6e 64 20 65 63 68 6f |ccepts (|and echo|
|00000700| 65 73 20 6f 6e 20 74 68 | 65 20 63 6f 6e 73 6f 6c |es on th|e consol|
|00000710| 65 29 20 61 20 70 61 72 | 74 69 61 6c 20 74 79 70 |e) a par|tial typ|
|00000720| 65 64 20 72 65 73 70 6f | 6e 73 65 20 74 6f 0d 61 |ed respo|nse to.a|
|00000730| 20 6d 75 6c 74 69 70 6c | 65 2d 63 68 6f 69 63 65 | multipl|e-choice|
|00000740| 20 71 75 65 73 74 69 6f | 6e 2c 20 65 78 70 61 6e | questio|n, expan|
|00000750| 64 69 6e 67 20 74 68 65 | 20 72 65 73 70 6f 6e 73 |ding the| respons|
|00000760| 65 20 74 6f 20 70 72 69 | 6e 74 20 74 68 65 20 66 |e to pri|nt the f|
|00000770| 75 6c 6c 20 61 6e 73 77 | 65 72 20 74 68 61 74 0d |ull answ|er that.|
|00000780| 69 74 20 75 6e 69 71 75 | 65 6c 79 20 73 70 65 63 |it uniqu|ely spec|
|00000790| 69 66 69 65 73 2e 20 49 | 66 20 61 6c 74 65 72 6e |ifies. I|f altern|
|000007a0| 61 74 69 76 65 20 61 6e | 73 77 65 72 73 20 62 65 |ative an|swers be|
|000007b0| 67 69 6e 20 77 69 74 68 | 20 74 68 65 20 73 61 6d |gin with| the sam|
|000007c0| 65 20 6c 65 74 74 65 72 | 73 20 28 65 2e 67 2e 0d |e letter|s (e.g..|
|000007d0| 22 41 72 61 62 69 63 22 | 20 61 6e 64 20 22 41 72 |"Arabic"| and "Ar|
|000007e0| 6d 65 6e 69 61 6e 22 29 | 20 74 68 65 6e 20 4d 75 |menian")| then Mu|
|000007f0| 6c 74 69 70 6c 65 43 68 | 6f 69 63 65 20 6b 65 65 |ltipleCh|oice kee|
|00000800| 70 73 20 61 63 63 65 70 | 74 69 6e 67 20 63 68 61 |ps accep|ting cha|
|00000810| 72 61 63 74 65 72 73 20 | 75 6e 74 69 6c 20 61 6e |racters |until an|
|00000820| 0d 61 6e 73 77 65 72 20 | 69 73 20 75 6e 69 71 75 |.answer |is uniqu|
|00000830| 65 6c 79 20 64 65 74 65 | 72 6d 69 6e 65 64 2e 20 |ely dete|rmined. |
|00000840| 54 79 70 69 6e 67 20 61 | 6e 79 20 6e 6f 6e 2d 70 |Typing a|ny non-p|
|00000850| 72 69 6e 74 69 6e 67 20 | 63 68 61 72 61 63 74 65 |rinting |characte|
|00000860| 72 20 28 65 2e 67 2e 20 | 52 65 74 75 72 6e 20 6f |r (e.g. |Return o|
|00000870| 72 0d 45 6e 74 65 72 29 | 20 74 65 72 6d 69 6e 61 |r.Enter)| termina|
|00000880| 74 65 73 20 74 68 65 20 | 74 79 70 65 64 20 73 74 |tes the |typed st|
|00000890| 72 69 6e 67 2c 20 65 2e | 67 2e 20 74 6f 20 64 69 |ring, e.|g. to di|
|000008a0| 73 74 69 6e 67 75 69 73 | 68 20 22 61 6e 74 22 20 |stinguis|h "ant" |
|000008b0| 66 72 6f 6d 20 22 61 6e | 74 65 61 74 65 72 22 2e |from "an|teater".|
|000008c0| 0d 49 66 20 74 68 65 20 | 74 79 70 65 64 20 73 74 |.If the |typed st|
|000008d0| 72 69 6e 67 20 64 6f 65 | 73 6e 27 74 20 6d 61 74 |ring doe|sn't mat|
|000008e0| 63 68 20 61 6e 79 20 6f | 66 20 74 68 65 20 73 75 |ch any o|f the su|
|000008f0| 70 70 6c 69 65 64 20 61 | 6e 73 77 65 72 20 73 74 |pplied a|nswer st|
|00000900| 72 69 6e 67 73 20 74 68 | 65 6e 0d 4d 75 6c 74 69 |rings th|en.Multi|
|00000910| 70 6c 65 43 68 6f 69 63 | 65 20 6d 61 6b 65 73 20 |pleChoic|e makes |
|00000920| 74 68 65 20 64 65 66 61 | 75 6c 74 43 68 6f 69 63 |the defa|ultChoic|
|00000930| 65 2e 20 54 68 75 73 20 | 74 68 65 20 75 73 65 72 |e. Thus |the user|
|00000940| 20 63 61 6e 20 73 65 6c | 65 63 74 20 74 68 65 20 | can sel|ect the |
|00000950| 64 65 66 61 75 6c 74 0d | 61 6e 73 77 65 72 20 62 |default.|answer b|
|00000960| 79 20 6a 75 73 74 20 68 | 69 74 74 69 6e 67 20 72 |y just h|itting r|
|00000970| 65 74 75 72 6e 2e 0d 0d | 59 65 73 4f 72 4e 6f 28 |eturn...|YesOrNo(|
|00000980| 29 20 72 65 73 74 72 69 | 63 74 73 20 74 68 65 20 |) restri|cts the |
|00000990| 61 6e 73 77 65 72 73 20 | 74 6f 20 22 59 65 73 22 |answers |to "Yes"|
|000009a0| 20 61 6e 64 20 22 4e 6f | 22 2c 20 77 69 74 68 20 | and "No|", with |
|000009b0| 61 20 42 6f 6f 6c 65 61 | 6e 20 61 72 67 75 6d 65 |a Boolea|n argume|
|000009c0| 6e 74 0d 73 70 65 63 69 | 66 79 69 6e 67 20 74 68 |nt.speci|fying th|
|000009d0| 65 20 64 65 66 61 75 6c | 74 2e 0d 0d 45 58 41 4d |e defaul|t...EXAM|
|000009e0| 50 4c 45 3a 0d 09 73 74 | 61 74 69 63 20 63 68 61 |PLE:..st|atic cha|
|000009f0| 72 20 62 72 65 61 64 5b | 5d 3d 22 42 72 65 61 64 |r bread[|]="Bread|
|00000a00| 22 2c 66 69 73 68 5b 5d | 3d 22 46 69 73 68 22 2c |",fish[]|="Fish",|
|00000a10| 66 6f 77 6c 5b 5d 3d 22 | 46 6f 77 6c 22 3b 0d 09 |fowl[]="|Fowl";..|
|00000a20| 73 74 61 74 69 63 20 63 | 68 61 72 20 2a 62 72 65 |static c|har *bre|
|00000a30| 61 64 46 69 73 68 46 6f | 77 6c 5b 5d 3d 7b 62 72 |adFishFo|wl[]={br|
|00000a40| 65 61 64 2c 66 69 73 68 | 2c 66 6f 77 6c 7d 3b 0d |ead,fish|,fowl};.|
|00000a50| 09 73 68 6f 72 74 20 63 | 68 6f 69 63 65 3d 31 3b |.short c|hoice=1;|
|00000a60| 0d 09 0d 09 2f 2f 20 6e | 65 77 20 77 61 79 0d 09 |....// n|ew way..|
|00000a70| 63 68 6f 69 63 65 3d 43 | 68 6f 6f 73 65 28 63 68 |choice=C|hoose(ch|
|00000a80| 6f 69 63 65 2c 22 57 6f | 75 6c 64 20 79 6f 75 20 |oice,"Wo|uld you |
|00000a90| 6c 69 6b 65 20 74 6f 20 | 65 61 74 20 25 73 3f 5c |like to |eat %s?\|
|00000aa0| 6e 22 2c 62 72 65 61 64 | 46 69 73 68 46 6f 77 6c |n",bread|FishFowl|
|00000ab0| 2c 33 29 3b 09 0d 09 73 | 74 69 6c 6c 48 75 6e 67 |,3);...s|tillHung|
|00000ac0| 72 79 3d 43 68 6f 6f 73 | 65 28 73 74 69 6c 6c 48 |ry=Choos|e(stillH|
|00000ad0| 75 6e 67 72 79 2c 22 44 | 6f 20 79 6f 75 20 77 61 |ungry,"D|o you wa|
|00000ae0| 6e 74 20 64 65 73 73 65 | 72 74 3f 5c 6e 22 2c 6e |nt desse|rt?\n",n|
|00000af0| 6f 59 65 73 2c 32 29 3b | 0d 09 0d 09 2f 2f 20 6f |oYes,2);|....// o|
|00000b00| 6c 64 20 77 61 79 0d 09 | 70 72 69 6e 74 66 28 22 |ld way..|printf("|
|00000b10| 57 6f 75 6c 64 20 79 6f | 75 20 6c 69 6b 65 20 74 |Would yo|u like t|
|00000b20| 6f 20 65 61 74 20 42 72 | 65 61 64 2c 20 46 69 73 |o eat Br|ead, Fis|
|00000b30| 68 2c 20 6f 72 20 46 6f | 77 6c 3f 22 29 3b 0d 09 |h, or Fo|wl?");..|
|00000b40| 63 68 6f 69 63 65 3d 4d | 75 6c 74 69 70 6c 65 43 |choice=M|ultipleC|
|00000b50| 68 6f 69 63 65 28 63 68 | 6f 69 63 65 2c 33 2c 62 |hoice(ch|oice,3,b|
|00000b60| 72 65 61 64 46 69 73 68 | 46 6f 77 6c 29 3b 0d 09 |readFish|Fowl);..|
|00000b70| 70 72 69 6e 74 66 28 22 | 5c 6e 22 29 3b 0d 09 0d |printf("|\n");...|
|00000b80| 09 2f 2f 20 6f 6c 64 20 | 77 61 79 0d 09 70 72 69 |.// old |way..pri|
|00000b90| 6e 74 66 28 22 44 6f 20 | 79 6f 75 20 77 61 6e 74 |ntf("Do |you want|
|00000ba0| 20 64 65 73 73 65 72 74 | 3f 22 29 3b 0d 09 63 68 | dessert|?");..ch|
|00000bb0| 6f 69 63 65 3d 59 65 73 | 4f 72 4e 6f 28 63 68 6f |oice=Yes|OrNo(cho|
|00000bc0| 69 63 65 29 3b 0d 09 70 | 72 69 6e 74 66 28 22 5c |ice);..p|rintf("\|
|00000bd0| 6e 22 29 3b 0d 0d 4e 4f | 54 45 3a 0d 54 68 65 20 |n");..NO|TE:.The |
|00000be0| 64 65 63 6c 61 72 61 74 | 69 6f 6e 73 20 61 62 6f |declarat|ions abo|
|00000bf0| 76 65 20 65 78 70 6c 69 | 63 69 74 6c 79 20 61 6c |ve expli|citly al|
|00000c00| 6c 6f 63 61 74 65 20 73 | 70 61 63 65 20 66 6f 72 |locate s|pace for|
|00000c10| 20 74 68 65 20 73 74 72 | 69 6e 67 73 20 22 42 72 | the str|ings "Br|
|00000c20| 65 61 64 22 20 61 6e 64 | 20 22 46 69 73 68 22 2e |ead" and| "Fish".|
|00000c30| 20 0d 49 6e 20 61 20 73 | 74 61 6e 64 2d 61 6c 6f | .In a s|tand-alo|
|00000c40| 6e 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 79 |ne appli|cation y|
|00000c50| 6f 75 20 63 6f 75 6c 64 | 20 69 6d 70 6c 69 63 69 |ou could| implici|
|00000c60| 74 6c 79 20 61 6c 6c 6f | 63 61 74 65 20 74 68 61 |tly allo|cate tha|
|00000c70| 74 20 73 70 61 63 65 2c | 0d 09 63 68 61 72 20 2a |t space,|..char *|
|00000c80| 62 72 65 61 64 46 69 73 | 68 46 6f 77 6c 5b 5d 3d |breadFis|hFowl[]=|
|00000c90| 7b 22 42 72 65 61 64 22 | 2c 22 46 69 73 68 22 2c |{"Bread"|,"Fish",|
|00000ca0| 22 46 6f 77 6c 22 7d 3b | 0d 62 75 74 20 74 68 65 |"Fowl"};|.but the|
|00000cb0| 20 54 48 49 4e 4b 20 43 | 20 63 6f 6d 70 69 6c 65 | THINK C| compile|
|00000cc0| 72 20 64 6f 65 73 6e 27 | 74 20 61 6c 6c 6f 77 20 |r doesn'|t allow |
|00000cd0| 74 68 69 73 20 69 6e 20 | 63 6f 64 65 20 72 65 73 |this in |code res|
|00000ce0| 6f 75 72 63 65 73 20 0d | 28 65 2e 67 2e 20 61 20 |ources .|(e.g. a |
|00000cf0| 4d 41 54 4c 41 42 20 4d | 45 58 20 66 69 6c 65 29 |MATLAB M|EX file)|
|00000d00| 2e 0d 0d 48 49 53 54 4f | 52 59 3a 0d 32 2f 31 36 |...HISTO|RY:.2/16|
|00000d10| 2f 39 33 09 64 67 70 09 | 77 72 6f 74 65 20 59 65 |/93.dgp.|wrote Ye|
|00000d20| 73 4f 72 4e 6f 28 29 2e | 0d 35 2f 32 34 2f 39 33 |sOrNo().|.5/24/93|
|00000d30| 09 64 67 70 09 61 64 64 | 65 64 20 4d 75 6c 74 69 |.dgp.add|ed Multi|
|00000d40| 70 6c 65 43 68 6f 69 63 | 65 28 29 2e 0d 39 2f 32 |pleChoic|e()..9/2|
|00000d50| 34 2f 39 33 09 64 67 70 | 09 63 6f 73 6d 65 74 69 |4/93.dgp|.cosmeti|
|00000d60| 63 2e 0d 31 2f 32 35 2f | 39 34 20 64 67 70 09 65 |c..1/25/|94 dgp.e|
|00000d70| 6e 68 61 6e 63 65 64 20 | 4d 75 6c 74 69 70 6c 65 |nhanced |Multiple|
|00000d80| 43 68 6f 69 63 65 28 29 | 20 74 6f 20 61 63 63 65 |Choice()| to acce|
|00000d90| 70 74 20 63 68 61 72 61 | 63 74 65 72 73 20 75 6e |pt chara|cters un|
|00000da0| 74 69 6c 20 74 68 65 79 | 20 75 6e 69 71 75 65 6c |til they| uniquel|
|00000db0| 79 0d 09 09 09 73 70 65 | 63 69 66 79 20 61 6e 20 |y....spe|cify an |
|00000dc0| 61 6e 73 77 65 72 2c 20 | 61 73 20 73 75 67 67 65 |answer, |as sugge|
|00000dd0| 73 74 65 64 20 62 79 20 | 42 61 72 74 20 46 61 72 |sted by |Bart Far|
|00000de0| 65 6c 6c 2e 0d 37 2f 39 | 2f 39 34 09 64 67 70 20 |ell..7/9|/94.dgp |
|00000df0| 61 64 64 65 64 20 43 68 | 6f 6f 73 65 28 29 2e 0d |added Ch|oose()..|
|00000e00| 37 2f 31 33 2f 39 34 09 | 64 67 70 20 72 65 6e 61 |7/13/94.|dgp rena|
|00000e10| 6d 65 64 20 66 69 6c 65 | 20 22 43 68 6f 6f 73 65 |med file| "Choose|
|00000e20| 2e 63 22 2e 0d 38 2f 31 | 2f 39 34 09 64 67 70 20 |.c"..8/1|/94.dgp |
|00000e30| 66 69 78 65 64 20 62 75 | 67 20 69 6e 20 4d 75 6c |fixed bu|g in Mul|
|00000e40| 74 69 70 6c 65 43 68 6f | 69 63 65 28 29 2c 20 49 |tipleCho|ice(), I|
|00000e50| 20 77 61 73 20 62 61 63 | 6b 73 70 61 63 69 6e 67 | was bac|kspacing|
|00000e60| 20 6f 6e 65 20 74 6f 6f | 20 6d 61 6e 79 20 74 69 | one too| many ti|
|00000e70| 6d 65 73 2e 0d 39 2f 32 | 31 2f 39 34 20 64 67 70 |mes..9/2|1/94 dgp|
|00000e80| 20 61 64 64 65 64 20 66 | 66 6c 75 73 68 28 73 74 | added f|flush(st|
|00000e90| 64 69 6e 29 20 74 6f 20 | 4d 75 6c 74 69 70 6c 65 |din) to |Multiple|
|00000ea0| 43 68 6f 69 63 65 28 29 | 2c 20 77 68 69 63 68 20 |Choice()|, which |
|00000eb0| 77 6f 72 6b 73 20 62 65 | 74 74 65 72 20 77 68 65 |works be|tter whe|
|00000ec0| 6e 0d 09 09 09 74 68 65 | 72 65 27 73 20 6e 6f 20 |n....the|re's no |
|00000ed0| 75 6e 62 75 66 66 65 72 | 65 64 20 69 6e 70 75 74 |unbuffer|ed input|
|00000ee0| 2e 0d 31 2f 35 2f 39 35 | 20 64 67 70 20 75 70 64 |..1/5/95| dgp upd|
|00000ef0| 61 74 65 64 20 74 6f 20 | 43 57 35 2c 20 65 6c 69 |ated to |CW5, eli|
|00000f00| 6d 69 6e 61 74 69 6e 67 | 20 74 68 65 20 63 6c 75 |minating| the clu|
|00000f10| 64 67 65 73 20 77 69 74 | 68 20 53 49 4f 55 58 74 |dges wit|h SIOUXt|
|00000f20| 65 78 74 57 69 6e 64 6f | 77 2e 0d 2a 2f 0d 23 69 |extWindo|w..*/.#i|
|00000f30| 6e 63 6c 75 64 65 20 22 | 56 69 64 65 6f 54 6f 6f |nclude "|VideoToo|
|00000f40| 6c 62 6f 78 2e 68 22 0d | 23 69 6e 63 6c 75 64 65 |lbox.h".|#include|
|00000f50| 20 3c 61 73 73 65 72 74 | 2e 68 3e 0d 23 69 66 20 | <assert|.h>.#if |
|00000f60| 21 64 65 66 69 6e 65 64 | 28 5f 5f 54 59 50 45 53 |!defined|(__TYPES|
|00000f70| 5f 5f 29 0d 09 74 79 70 | 65 64 65 66 20 75 6e 73 |__)..typ|edef uns|
|00000f80| 69 67 6e 65 64 20 63 68 | 61 72 20 42 6f 6f 6c 65 |igned ch|ar Boole|
|00000f90| 61 6e 3b 0d 23 65 6e 64 | 69 66 0d 73 74 61 74 69 |an;.#end|if.stati|
|00000fa0| 63 20 63 68 61 72 20 6e | 6f 5b 5d 3d 22 4e 6f 22 |c char n|o[]="No"|
|00000fb0| 2c 79 65 73 5b 5d 3d 22 | 59 65 73 22 3b 0d 63 68 |,yes[]="|Yes";.ch|
|00000fc0| 61 72 20 2a 6e 6f 59 65 | 73 5b 5d 3d 7b 6e 6f 2c |ar *noYe|s[]={no,|
|00000fd0| 79 65 73 7d 3b 0d 0d 69 | 6e 74 20 43 68 6f 6f 73 |yes};..i|nt Choos|
|00000fe0| 65 28 69 6e 74 20 64 65 | 66 61 75 6c 74 43 68 6f |e(int de|faultCho|
|00000ff0| 69 63 65 2c 63 6f 6e 73 | 74 20 63 68 61 72 20 2a |ice,cons|t char *|
|00001000| 71 75 65 72 79 2c 63 68 | 61 72 20 2a 63 68 6f 69 |query,ch|ar *choi|
|00001010| 63 65 73 5b 5d 2c 69 6e | 74 20 6e 29 0d 7b 0d 09 |ces[],in|t n).{..|
|00001020| 42 6f 6f 6c 65 61 6e 20 | 6e 65 77 6c 69 6e 65 3b |Boolean |newline;|
|00001030| 0d 09 69 6e 74 20 63 68 | 6f 69 63 65 3b 0d 09 73 |..int ch|oice;..s|
|00001040| 74 61 74 69 63 20 63 68 | 61 72 20 2a 73 74 72 69 |tatic ch|ar *stri|
|00001050| 6e 67 3d 4e 55 4c 4c 3b | 0d 09 63 68 61 72 20 2a |ng=NULL;|..char *|
|00001060| 63 68 6f 69 63 65 4c 69 | 73 74 3b 0d 0d 09 6e 65 |choiceLi|st;...ne|
|00001070| 77 6c 69 6e 65 3d 28 71 | 75 65 72 79 5b 73 74 72 |wline=(q|uery[str|
|00001080| 6c 65 6e 28 71 75 65 72 | 79 29 2d 31 5d 3d 3d 27 |len(quer|y)-1]=='|
|00001090| 5c 6e 27 29 3b 0d 09 63 | 68 6f 69 63 65 4c 69 73 |\n');..c|hoiceLis|
|000010a0| 74 3d 43 68 6f 69 63 65 | 53 74 72 28 63 68 6f 69 |t=Choice|Str(choi|
|000010b0| 63 65 73 2c 6e 29 3b 0d | 09 73 74 72 69 6e 67 3d |ces,n);.|.string=|
|000010c0| 6d 61 6c 6c 6f 63 28 73 | 74 72 6c 65 6e 28 71 75 |malloc(s|trlen(qu|
|000010d0| 65 72 79 29 2b 73 74 72 | 6c 65 6e 28 63 68 6f 69 |ery)+str|len(choi|
|000010e0| 63 65 4c 69 73 74 29 2b | 31 29 3b 0d 09 61 73 73 |ceList)+|1);..ass|
|000010f0| 65 72 74 28 73 74 72 69 | 6e 67 21 3d 4e 55 4c 4c |ert(stri|ng!=NULL|
|00001100| 29 3b 0d 09 73 70 72 69 | 6e 74 66 28 73 74 72 69 |);..spri|ntf(stri|
|00001110| 6e 67 2c 71 75 65 72 79 | 2c 63 68 6f 69 63 65 4c |ng,query|,choiceL|
|00001120| 69 73 74 29 3b 0d 09 69 | 66 28 6e 65 77 6c 69 6e |ist);..i|f(newlin|
|00001130| 65 29 73 74 72 69 6e 67 | 5b 73 74 72 6c 65 6e 28 |e)string|[strlen(|
|00001140| 73 74 72 69 6e 67 29 2d | 31 5d 3d 30 3b 09 2f 2f |string)-|1]=0;.//|
|00001150| 20 73 74 72 69 70 20 74 | 68 65 20 74 72 61 69 6c | strip t|he trail|
|00001160| 69 6e 67 20 6e 65 77 6c | 69 6e 65 3b 20 70 72 69 |ing newl|ine; pri|
|00001170| 6e 74 20 69 74 20 6c 61 | 74 65 72 2e 0d 09 42 72 |nt it la|ter...Br|
|00001180| 65 61 6b 4c 69 6e 65 73 | 28 73 74 72 69 6e 67 2c |eakLines|(string,|
|00001190| 38 30 29 3b 0d 09 70 72 | 69 6e 74 66 28 22 25 73 |80);..pr|intf("%s|
|000011a0| 22 2c 73 74 72 69 6e 67 | 29 3b 0d 09 66 72 65 65 |",string|);..free|
|000011b0| 28 73 74 72 69 6e 67 29 | 3b 0d 09 63 68 6f 69 63 |(string)|;..choic|
|000011c0| 65 3d 4d 75 6c 74 69 70 | 6c 65 43 68 6f 69 63 65 |e=Multip|leChoice|
|000011d0| 28 64 65 66 61 75 6c 74 | 43 68 6f 69 63 65 2c 6e |(default|Choice,n|
|000011e0| 2c 63 68 6f 69 63 65 73 | 29 3b 0d 09 69 66 28 6e |,choices|);..if(n|
|000011f0| 65 77 6c 69 6e 65 29 70 | 72 69 6e 74 66 28 22 5c |ewline)p|rintf("\|
|00001200| 6e 22 29 3b 0d 09 72 65 | 74 75 72 6e 20 63 68 6f |n");..re|turn cho|
|00001210| 69 63 65 3b 0d 7d 0d 0d | 42 6f 6f 6c 65 61 6e 20 |ice;.}..|Boolean |
|00001220| 59 65 73 4f 72 4e 6f 28 | 42 6f 6f 6c 65 61 6e 20 |YesOrNo(|Boolean |
|00001230| 64 65 66 61 75 6c 74 43 | 68 6f 69 63 65 29 0d 2f |defaultC|hoice)./|
|00001240| 2a 20 41 63 63 65 70 74 | 20 22 79 22 20 6f 72 20 |* Accept| "y" or |
|00001250| 22 6e 22 20 61 6e 64 20 | 73 70 65 6c 6c 20 6f 75 |"n" and |spell ou|
|00001260| 74 20 22 59 65 73 22 20 | 6f 72 20 22 4e 6f 22 2e |t "Yes" |or "No".|
|00001270| 20 41 6e 79 74 68 69 6e | 67 20 65 6c 73 65 20 67 | Anythin|g else g|
|00001280| 65 74 73 20 64 65 66 61 | 75 6c 74 43 68 6f 69 63 |ets defa|ultChoic|
|00001290| 65 2e 20 2a 2f 0d 7b 0d | 09 72 65 74 75 72 6e 20 |e. */.{.|.return |
|000012a0| 4d 75 6c 74 69 70 6c 65 | 43 68 6f 69 63 65 28 64 |Multiple|Choice(d|
|000012b0| 65 66 61 75 6c 74 43 68 | 6f 69 63 65 2c 32 2c 6e |efaultCh|oice,2,n|
|000012c0| 6f 59 65 73 29 3b 0d 7d | 0d 0d 69 6e 74 20 4d 75 |oYes);.}|..int Mu|
|000012d0| 6c 74 69 70 6c 65 43 68 | 6f 69 63 65 28 73 68 6f |ltipleCh|oice(sho|
|000012e0| 72 74 20 64 65 66 61 75 | 6c 74 43 68 6f 69 63 65 |rt defau|ltChoice|
|000012f0| 2c 73 68 6f 72 74 20 6e | 43 68 6f 69 63 65 73 2c |,short n|Choices,|
|00001300| 63 68 61 72 20 2a 63 68 | 6f 69 63 65 73 5b 5d 29 |char *ch|oices[])|
|00001310| 0d 7b 0d 09 63 68 61 72 | 20 63 2c 73 5b 36 34 5d |.{..char| c,s[64]|
|00001320| 3b 0d 09 73 68 6f 72 74 | 20 69 2c 6a 2c 63 68 6f |;..short| i,j,cho|
|00001330| 69 63 65 2c 6d 61 74 63 | 68 2c 6d 61 74 63 68 65 |ice,matc|h,matche|
|00001340| 73 2c 6b 3b 0d 0d 09 70 | 72 69 6e 74 66 28 22 20 |s,k;...p|rintf(" |
|00001350| 28 25 73 29 3a 22 2c 63 | 68 6f 69 63 65 73 5b 64 |(%s):",c|hoices[d|
|00001360| 65 66 61 75 6c 74 43 68 | 6f 69 63 65 5d 29 3b 0d |efaultCh|oice]);.|
|00001370| 09 66 66 6c 75 73 68 28 | 73 74 64 6f 75 74 29 3b |.fflush(|stdout);|
|00001380| 0d 09 66 6f 72 28 6b 3d | 30 3b 6b 3c 73 69 7a 65 |..for(k=|0;k<size|
|00001390| 6f 66 28 73 29 2d 31 3b | 6b 2b 2b 29 7b 0d 09 09 |of(s)-1;|k++){...|
|000013a0| 6d 61 74 63 68 65 73 3d | 30 3b 0d 09 09 64 6f 7b |matches=|0;...do{|
|000013b0| 0d 09 09 09 63 3d 67 65 | 74 63 68 61 72 55 6e 62 |....c=ge|tcharUnb|
|000013c0| 75 66 66 65 72 65 64 28 | 29 3b 0d 09 09 7d 77 68 |uffered(|);...}wh|
|000013d0| 69 6c 65 28 63 3d 3d 45 | 4f 46 29 3b 0d 09 09 69 |ile(c==E|OF);...i|
|000013e0| 66 28 63 3d 3d 31 34 29 | 61 62 6f 72 74 28 29 3b |f(c==14)|abort();|
|000013f0| 09 09 09 2f 2a 20 43 72 | 75 64 65 20 74 65 73 74 |.../* Cr|ude test|
|00001400| 20 66 6f 72 20 63 6f 6d | 6d 61 6e 64 2d 70 65 72 | for com|mand-per|
|00001410| 69 6f 64 2e 20 2a 2f 0d | 09 09 69 66 28 21 69 73 |iod. */.|..if(!is|
|00001420| 70 72 69 6e 74 28 63 29 | 29 63 3d 30 3b 0d 09 09 |print(c)|)c=0;...|
|00001430| 73 5b 6b 5d 3d 63 3b 0d | 09 09 73 5b 6b 2b 31 5d |s[k]=c;.|..s[k+1]|
|00001440| 3d 30 3b 0d 09 09 66 6f | 72 28 69 3d 30 3b 69 3c |=0;...fo|r(i=0;i<|
|00001450| 6e 43 68 6f 69 63 65 73 | 3b 69 2b 2b 29 7b 0d 09 |nChoices|;i++){..|
|00001460| 09 09 6d 61 74 63 68 3d | 31 3b 0d 09 09 09 66 6f |..match=|1;....fo|
|00001470| 72 28 6a 3d 30 3b 6a 3c | 3d 6b 3b 6a 2b 2b 29 6d |r(j=0;j<|=k;j++)m|
|00001480| 61 74 63 68 26 3d 28 74 | 6f 6c 6f 77 65 72 28 73 |atch&=(t|olower(s|
|00001490| 5b 6a 5d 29 3d 3d 74 6f | 6c 6f 77 65 72 28 63 68 |[j])==to|lower(ch|
|000014a0| 6f 69 63 65 73 5b 69 5d | 5b 6a 5d 29 29 3b 0d 09 |oices[i]|[j]));..|
|000014b0| 09 09 69 66 28 6d 61 74 | 63 68 29 7b 0d 09 09 09 |..if(mat|ch){....|
|000014c0| 09 63 68 6f 69 63 65 3d | 69 3b 0d 09 09 09 09 6d |.choice=|i;.....m|
|000014d0| 61 74 63 68 65 73 2b 2b | 3b 0d 09 09 09 7d 0d 09 |atches++|;....}..|
|000014e0| 09 7d 0d 09 09 69 66 28 | 6d 61 74 63 68 65 73 3c |.}...if(|matches<|
|000014f0| 3d 31 20 7c 7c 20 73 5b | 6b 5d 3d 3d 30 29 62 72 |=1 || s[|k]==0)br|
|00001500| 65 61 6b 3b 0d 09 09 70 | 72 69 6e 74 66 28 22 25 |eak;...p|rintf("%|
|00001510| 63 22 2c 63 29 3b 0d 09 | 09 66 66 6c 75 73 68 28 |c",c);..|.fflush(|
|00001520| 73 74 64 6f 75 74 29 3b | 0d 09 7d 0d 09 66 66 6c |stdout);|..}..ffl|
|00001530| 75 73 68 28 73 74 64 69 | 6e 29 3b 09 2f 2f 20 67 |ush(stdi|n);.// g|
|00001540| 65 74 20 72 69 64 20 6f | 66 20 61 6e 79 20 75 6e |et rid o|f any un|
|00001550| 75 73 65 64 20 69 6e 70 | 75 74 0d 09 0d 09 2f 2a |used inp|ut..../*|
|00001560| 20 45 72 61 73 65 20 70 | 61 72 74 69 61 6c 20 61 | Erase p|artial a|
|00001570| 6e 73 77 65 72 2c 20 77 | 68 69 63 68 20 63 6f 75 |nswer, w|hich cou|
|00001580| 6c 64 20 62 65 20 6c 6f | 6e 67 65 72 20 74 68 61 |ld be lo|nger tha|
|00001590| 6e 20 74 68 65 20 64 65 | 66 61 75 6c 74 20 61 6e |n the de|fault an|
|000015a0| 73 77 65 72 2e 20 2a 2f | 0d 09 2f 2a 20 2d 31 20 |swer. */|../* -1 |
|000015b0| 62 65 63 61 75 73 65 20 | 77 65 20 64 69 64 6e 27 |because |we didn'|
|000015c0| 74 20 70 72 69 6e 74 20 | 74 68 65 20 6c 61 73 74 |t print |the last|
|000015d0| 20 63 68 61 72 61 63 74 | 65 72 20 74 79 70 65 64 | charact|er typed|
|000015e0| 20 62 79 20 74 68 65 20 | 75 73 65 72 2e 20 2a 2f | by the |user. */|
|000015f0| 0d 09 6b 3d 73 74 72 6c | 65 6e 28 73 29 2d 31 3b |..k=strl|en(s)-1;|
|00001600| 0d 09 66 6f 72 28 6a 3d | 30 3b 6a 3c 6b 3b 6a 2b |..for(j=|0;j<k;j+|
|00001610| 2b 29 70 72 69 6e 74 66 | 28 22 5c 62 20 5c 62 22 |+)printf|("\b \b"|
|00001620| 29 3b 0d 09 0d 09 2f 2a | 20 50 72 69 6e 74 20 61 |);..../*| Print a|
|00001630| 6e 73 77 65 72 20 2a 2f | 0d 09 69 66 28 6d 61 74 |nswer */|..if(mat|
|00001640| 63 68 65 73 3d 3d 30 29 | 63 68 6f 69 63 65 3d 64 |ches==0)|choice=d|
|00001650| 65 66 61 75 6c 74 43 68 | 6f 69 63 65 3b 0d 09 70 |efaultCh|oice;..p|
|00001660| 72 69 6e 74 66 28 22 25 | 73 2e 22 2c 63 68 6f 69 |rintf("%|s.",choi|
|00001670| 63 65 73 5b 63 68 6f 69 | 63 65 5d 29 3b 0d 09 66 |ces[choi|ce]);..f|
|00001680| 66 6c 75 73 68 28 73 74 | 64 6f 75 74 29 3b 0d 09 |flush(st|dout);..|
|00001690| 72 65 74 75 72 6e 20 63 | 68 6f 69 63 65 3b 0d 7d |return c|hoice;.}|
|000016a0| 0d 0d 63 68 61 72 20 2a | 43 68 6f 69 63 65 53 74 |..char *|ChoiceSt|
|000016b0| 72 28 63 68 61 72 20 2a | 63 68 6f 69 63 65 73 5b |r(char *|choices[|
|000016c0| 5d 2c 69 6e 74 20 6e 43 | 68 6f 69 63 65 73 29 0d |],int nC|hoices).|
|000016d0| 7b 0d 09 69 6e 74 20 69 | 2c 73 69 7a 65 3b 0d 09 |{..int i|,size;..|
|000016e0| 73 74 61 74 69 63 20 63 | 68 61 72 20 2a 73 74 72 |static c|har *str|
|000016f0| 69 6e 67 3d 4e 55 4c 4c | 3b 0d 09 0d 09 73 69 7a |ing=NULL|;....siz|
|00001700| 65 3d 30 3b 0d 09 66 6f | 72 28 69 3d 30 3b 69 3c |e=0;..fo|r(i=0;i<|
|00001710| 6e 43 68 6f 69 63 65 73 | 3b 69 2b 2b 29 73 69 7a |nChoices|;i++)siz|
|00001720| 65 2b 3d 73 74 72 6c 65 | 6e 28 63 68 6f 69 63 65 |e+=strle|n(choice|
|00001730| 73 5b 69 5d 29 2b 36 3b | 0d 09 73 74 72 69 6e 67 |s[i])+6;|..string|
|00001740| 3d 72 65 61 6c 6c 6f 63 | 28 73 74 72 69 6e 67 2c |=realloc|(string,|
|00001750| 73 69 7a 65 29 3b 0d 09 | 61 73 73 65 72 74 28 73 |size);..|assert(s|
|00001760| 74 72 69 6e 67 21 3d 4e | 55 4c 4c 29 3b 0d 09 73 |tring!=N|ULL);..s|
|00001770| 74 72 69 6e 67 5b 30 5d | 3d 30 3b 0d 09 66 6f 72 |tring[0]|=0;..for|
|00001780| 28 69 3d 30 3b 69 3c 6e | 43 68 6f 69 63 65 73 3b |(i=0;i<n|Choices;|
|00001790| 69 2b 2b 29 7b 0d 09 09 | 73 70 72 69 6e 74 66 28 |i++){...|sprintf(|
|000017a0| 73 74 72 69 6e 67 2c 22 | 25 73 25 73 22 2c 73 74 |string,"|%s%s",st|
|000017b0| 72 69 6e 67 2c 63 68 6f | 69 63 65 73 5b 69 5d 29 |ring,cho|ices[i])|
|000017c0| 3b 0d 09 09 69 66 28 69 | 3c 6e 43 68 6f 69 63 65 |;...if(i|<nChoice|
|000017d0| 73 2d 32 29 73 70 72 69 | 6e 74 66 28 73 74 72 69 |s-2)spri|ntf(stri|
|000017e0| 6e 67 2c 22 25 73 2c 20 | 22 2c 73 74 72 69 6e 67 |ng,"%s, |",string|
|000017f0| 29 3b 0d 09 09 69 66 28 | 69 3d 3d 6e 43 68 6f 69 |);...if(|i==nChoi|
|00001800| 63 65 73 2d 32 29 7b 0d | 09 09 09 69 66 28 6e 43 |ces-2){.|...if(nC|
|00001810| 68 6f 69 63 65 73 3e 32 | 29 73 70 72 69 6e 74 66 |hoices>2|)sprintf|
|00001820| 28 73 74 72 69 6e 67 2c | 22 25 73 2c 20 6f 72 20 |(string,|"%s, or |
|00001830| 22 2c 73 74 72 69 6e 67 | 29 3b 0d 09 09 09 65 6c |",string|);....el|
|00001840| 73 65 20 73 70 72 69 6e | 74 66 28 73 74 72 69 6e |se sprin|tf(strin|
|00001850| 67 2c 22 25 73 20 6f 72 | 20 22 2c 73 74 72 69 6e |g,"%s or| ",strin|
|00001860| 67 29 3b 0d 09 09 7d 0d | 09 09 69 66 28 69 3d 3d |g);...}.|..if(i==|
|00001870| 6e 43 68 6f 69 63 65 73 | 2d 31 29 73 70 72 69 6e |nChoices|-1)sprin|
|00001880| 74 66 28 73 74 72 69 6e | 67 2c 22 25 73 22 2c 73 |tf(strin|g,"%s",s|
|00001890| 74 72 69 6e 67 29 3b 0d | 09 7d 0d 09 72 65 74 75 |tring);.|.}..retu|
|000018a0| 72 6e 20 73 74 72 69 6e | 67 3b 0d 7d 0d 00 00 00 |rn strin|g;.}....|
|000018b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001900| 00 00 01 00 00 00 01 c6 | 00 00 00 c6 00 00 00 5e |........|.......^|
|00001910| 6d 70 f0 38 04 15 10 02 | da f1 01 05 6d 68 f0 32 |mp.8....|....mh.2|
|00001920| 04 1d 50 03 1e 0b 00 0f | ab 70 f0 30 04 28 58 03 |..P.....|.p.0.(X.|
|00001930| 08 43 68 6f 6f 73 65 2e | 63 00 02 00 00 00 50 61 |.Choose.|c.....Pa|
|00001940| 72 74 53 49 54 21 00 00 | 00 00 00 00 00 00 00 00 |rtSIT!..|........|
|00001950| 00 00 50 61 72 74 53 49 | 54 21 00 00 00 00 00 00 |..PartSI|T!......|
|00001960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001970| 00 00 ab bf ee 59 00 00 | 00 00 00 00 02 24 70 65 |.....Y..|.....$pe|
|00001980| 63 61 69 6c 20 4d 65 6e | 75 09 4e 65 77 46 6f 6c |cail Men|u.NewFol|
|00001990| 64 65 72 07 55 74 69 6c | 69 74 79 05 41 62 6f 75 |der.Util|ity.Abou|
|000019a0| 74 0a 74 69 6e 79 46 69 | 6e 64 65 72 07 4f 70 74 |t.tinyFi|nder.Opt|
|000019b0| 69 6f 6e 73 0b 48 6f 74 | 20 4b 65 79 73 2e 2e 2e |ions.Hot| Keys...|
|000019c0| 0c 53 70 65 63 69 61 6c | 20 4b 65 79 73 09 4b 65 |.Special| Keys.Ke|
|000019d0| 79 20 6e 61 6d 65 73 04 | 48 65 6c 70 04 46 69 6c |y names.|Help.Fil|
|000019e0| 65 0b 59 65 73 4e 6f 20 | 41 6c 65 72 74 07 53 79 |e.YesNo |Alert.Sy|
|000019f0| 73 20 45 72 72 11 45 72 | 72 6f 72 20 74 61 62 6c |s Err.Er|ror tabl|
|00001a00| 00 00 00 1e 00 29 00 07 | 01 73 02 23 00 29 00 07 |.....)..|.s.#.)..|
|00001a10| 01 73 02 23 00 00 17 43 | 00 00 00 00 00 00 00 00 |.s.#...C|........|
|00001a20| 00 00 00 00 00 4c 00 04 | 00 00 0e a0 00 00 0e a6 |.....L..|........|
|00001a30| 07 43 68 6f 6f 73 65 00 | 00 00 10 e6 00 00 10 ed |.Choose.|........|
|00001a40| 07 59 65 73 4f 72 4e 6f | 00 00 11 94 00 00 11 a2 |.YesOrNo|........|
|00001a50| 0f 4d 75 6c 74 69 70 6c | 65 43 68 6f 69 63 65 00 |.Multipl|eChoice.|
|00001a60| 00 00 15 40 00 00 15 49 | 09 43 68 6f 69 63 65 53 |...@...I|.ChoiceS|
|00001a70| 74 72 00 00 00 48 00 09 | 4d 6f 6e 61 63 6f 00 00 |tr...H..|Monaco..|
|00001a80| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001a90| 00 00 00 00 00 00 00 00 | 00 03 00 04 00 3e 00 04 |........|.....>..|
|00001aa0| 01 7d 02 63 00 3e 00 04 | 01 7d 02 63 ab b0 ad e1 |.}.c.>..|.}.c....|
|00001ab0| 00 00 13 68 00 00 13 6d | 00 00 12 4a 00 00 00 00 |...h...m|...J....|
|00001ac0| 00 04 00 01 00 01 00 00 | 01 00 00 00 01 c6 00 00 |........|........|
|00001ad0| 00 c6 00 00 00 5e 00 6a | d5 18 27 aa 00 00 00 1c |.....^.j|..'.....|
|00001ae0| 00 5e 00 01 4d 50 53 52 | 00 02 00 12 4d 57 42 42 |.^..MPSR|....MWBB|
|00001af0| 00 00 00 36 03 f0 ff ff | 00 00 00 00 00 00 00 00 |...6....|........|
|00001b00| 03 ef ff ff 00 00 00 22 | 00 00 00 00 03 ed ff ff |......."|........|
|00001b10| 00 00 00 72 00 00 00 00 | 03 f0 ff ff 00 00 00 be |...r....|........|
|00001b20| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+